<template>
  <!-- 登录 -->
  <SingIn v-if="type == 0" @navGetTo="navGetTo" />
  <!-- 注册 -->
  <Register v-if="type == 1" @navGetTo="navGetTo" />
  <!-- 找回密码 -->
  <Retrieve v-if="type == 2" @navGetTo="navGetTo" />
</template>

<script>
import { defineComponent, ref } from "vue";
import { useRoute } from "vue-router";
import SingIn from "./components/SingIn.vue";
import Retrieve from "./components/Retrieve.vue";
import Register from "./components/Register.vue";

export default defineComponent({
  setup() {
    const route = useRoute();
    const type = ref(0);
    const navGetTo = (index) => {
      type.value = index;
    };
    if (route.query.pcode) type.value = 1;
    return {
      type,
      navGetTo,
    };
  },
  components: {
    SingIn,
    Register,
    Retrieve,
  },
});
</script>

<style lang="less" scoped></style>
